<nz-page-header nzTitle="商品分类">
    <nz-breadcrumb nz-page-header-breadcrumb>
        <nz-breadcrumb-item>
            <a [routerLink]="['/']">首页</a>
        </nz-breadcrumb-item>
        <nz-breadcrumb-item>
            <a [routerLink]="['/mall']">商城</a>
        </nz-breadcrumb-item>
    </nz-breadcrumb>
</nz-page-header>

<nz-card [nzExtra]="extraAction">
    <ng-template #extraAction>
        <button nzSize="large" class="mr-4" nz-button (click)="add()" nzType="primary">{{'add.category' | translate}}</button>
        <button nzSize="large" nz-button (click)="refresh()">{{'refresh' | translate}}</button>
    </ng-template>
    <nz-table #dataTable nzShowSizeChanger nzShowPagination [nzFrontPagination]="false" [nzData]="dataItems" [nzTotal]="pageingInfo.totalItems"
        [(nzPageSize)]="pageingInfo.pageSize" [(nzPageIndex)]="pageingInfo.pageNumber" [nzLoading]="pageingInfo.isTableLoading" (nzPageIndexChange)="refresh()"
        (nzPageSizeChange)="refresh()">
        <thead>
            <tr>
                <!-- <th>Id</th> -->
                <th>Name</th>
                <th>Code</th>
                <th>Sort</th>
                <th>redirectUrl</th>
                <th>
                    全局显示
                    <tt-tooltip text="显示在所有APP的分类中"></tt-tooltip>
                </th>
                <th>
                    客户端
                    <tt-tooltip text="按需显示的APP"></tt-tooltip>
                </th>
                <th>ShopId</th>
                <th></th>

            </tr>
        </thead>
        <tbody>
            <tr *ngFor="let item of dataTable.data">
                <!-- <td>{{item.id}}</td> -->
                <td>
                    <nz-avatar nzShape="square" [nzSize]="64" nzSize="large" nzIcon="user" [nzSrc]="item.logoImageUrl"></nz-avatar>
                    {{item.name}}
                </td>
                <td>{{item.code}}</td>
                <td>{{item.sort}}</td>

                <td>{{item.redirectUrl}}</td>
                <td>
                    <i nz-icon nzType="check-circle" nzTheme="twotone" nzTwotoneColor="#52c41a" *ngIf="item.isGlobal"></i>
                </td>
                <td>
                    <nz-tag [nzColor]="getRndColor(app.appName)" *ngFor="let app of item.appProductCategories"> {{app.appName | translate}}</nz-tag>
                </td>
                <td>{{item.shopId}}</td>
                <td>
                    <button nz-button nzType="primary" nzShape="circle" [routerLink]="['/mall/spu-create', item.id]">
                        <i nz-icon nzType="plus"></i>
                    </button>
                    <nz-divider nzType=" vertical"></nz-divider>
                    <button nz-button nzType="primary" nzShape="circle" (click)="edit(item)">
                        <i nz-icon nzType="edit"></i>
                    </button>
                    <nz-divider nzType=" vertical"></nz-divider>
                    <button nz-button nzType="danger" nzShape="circle" nz-popconfirm [nzPopconfirmTitle]="'确定删除吗?'" (nzOnConfirm)="delete(item)"
                        nzPopconfirmPlacement="top"><i nz-icon nzType="delete"></i></button>
                </td>
            </tr>
        </tbody>
    </nz-table>
</nz-card>